<link href="{{$core_js}}/formValidation/css/cmxform.css" rel="stylesheet" type="text/css">

<script src="{{$core_js}}/formValidation/jquery.validate.js" type="text/javascript"></script>
<script type='text/javascript'>

     $(document).ready(function() {
                                 // This is for validation
                                 $("#commentForm").validate();
			        });

</script>

{{if $msg}}
<fieldset style="color:{{$message.$msg.0}}; font-size: 16px; background-color:grey">
    {{$message.$msg.1}}
</fieldset>
{{/if}}
<fieldset>
    <legend><b>{{if $is_edit}}Edit NNC Item ID{{else}}Add NNC Item ID{{/if}}</b></legend>
    <form id="commentForm" method="post" action="{{$base_index_url}}/product/admin/add_edit_nnci/">
    <table align="center">
        <tr>
            <td width="40%">NNC Item ID :</td>
            <td id="right" align=left><input class="required" style="width:300px" name="nnc_id" type="text" value="{{$edit_obj->nnc_id}}" ></td>
        <tr>
            <td valign="top">Description :</td>
            <td id="right" align=left><textarea class="required" style="width:300px; height:100px" name="desc" >{{$edit_obj->desc}}</textarea></td>
            <input name="id" type="hidden" value="{{$edit_obj->id}}" >
        </tr>
        <tr>
        {{if $is_edit}}
            <td><input id="submit" type="submit" name="edit" value="Edit" ></td>
         {{else}}
            <td><input id="submit" type="submit" name="add" value="Add" ></td>
         {{/if}}
        </tr>
    </table>
    </form>
</fieldset>

{{if !$is_edit}}
<fieldset>
    <center style="font-size: 16px">{{$page_link}}</center>
    <table class="display" width="100%" id="table">
        <thead>
             <tr>
                 <th class="sorting_asc">NNC Item ID</th>
                 <th class="sorting">Description</th>
                 <th class="sorting">Action</th>
             </tr>
        </thead>
        <tbody>
        {{assign var="i" value=1}}
        {{foreach from=$nnci_products item=result}}
            <tr class="{{if $i%2 == 1}}odd {{else}}even{{/if}}">
                <td class="sorting_1">{{$result->nnc_id}}</td>
                <td>{{$result->desc}}</td>
                <td><img onclick="document.location = '{{$base_index_url}}/product/admin/add_edit_nnci/select_nnic/{{$result->id}}'" style="cursor: pointer;" title="Edit/Update" src="{{$core_images}}/common/edit.png"> </td>
            </tr>
            <span style="display:none">{{$i++}}</span>
        {{/foreach}}
        </tbody>
    </table>
    <center style="font-size: 16px">{{$page_link}}</center>
</fieldset>
{{/if}}
